From 0a5b2bbc434d01260038e64a43152cf4f693dea4 Mon Sep 17 00:00:00 2001 From: Joan Torres Lopez Date: Mon, 16 Feb 2026 16:05:17 +0100 Subject: [PATCH] authPrompt: Use connectObject for userVerifier signals This allows cleanly disconnecting all signals at once when the authPrompt is destroyed, preventing potential issues from stale signal handlers. Part-of: (cherry picked from commit 8f9031688c4dc700f74936a2c1e0b221babb8253) --- js/gdm/authPrompt.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index fe81c9914..6692cb6bb 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -167,14 +167,16 @@ export const AuthPrompt = GObject.registerClass({ this._userVerifier = this._createUserVerifier(this._gdmClient, {reauthenticationOnly}); - this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this)); - this._userVerifier.connect('show-message', this._onShowMessage.bind(this)); - this._userVerifier.connect('show-choice-list', this._onShowChoiceList.bind(this)); - this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this)); - this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this)); - this._userVerifier.connect('reset', this._onReset.bind(this)); - this._userVerifier.connect('smartcard-status-changed', this._onSmartcardStatusChanged.bind(this)); - this._userVerifier.connect('credential-manager-authenticated', this._onCredentialManagerAuthenticated.bind(this)); + this._userVerifier.connectObject( + 'ask-question', (_, ...args) => this._onAskQuestion(...args), + 'show-message', (_, ...args) => this._onShowMessage(...args), + 'show-choice-list', (_, ...args) => this._onShowChoiceList(...args), + 'verification-failed', (_, ...args) => this._onVerificationFailed(...args), + 'verification-complete', () => this._onVerificationComplete(), + 'reset', () => this._onReset(), + 'smartcard-status-changed', () => this._onSmartcardStatusChanged(), + 'credential-manager-authenticated', () => this._onCredentialManagerAuthenticated(), + this); this.smartcardDetected = this._userVerifier.smartcardDetected; this.connect('destroy', this._onDestroy.bind(this)); @@ -231,6 +233,7 @@ export const AuthPrompt = GObject.registerClass({ _onDestroy() { this._inactiveEntry.destroy(); this._inactiveEntry = null; + this._userVerifier.disconnectObject(this); this._userVerifier.destroy(); this._userVerifier = null; this._entry = null; @@ -414,7 +417,7 @@ export const AuthPrompt = GObject.registerClass({ this._capsLockWarningLabel.visible = secret; } - _onAskQuestion(verifier, serviceName, question, secret) { + _onAskQuestion(serviceName, question, secret) { if (this._queryingService) this.clear(); @@ -439,7 +442,7 @@ export const AuthPrompt = GObject.registerClass({ this.emit('prompted'); } - _onShowChoiceList(userVerifier, serviceName, promptMessage, choiceList) { + _onShowChoiceList(serviceName, promptMessage, choiceList) { if (this._queryingService) this.clear(); @@ -478,7 +481,7 @@ export const AuthPrompt = GObject.registerClass({ this.reset(); } - _onShowMessage(_userVerifier, serviceName, message, type, showMessageResolver) { + _onShowMessage(serviceName, message, type, showMessageResolver) { this.setMessage(message, type); this.emit('prompted'); @@ -492,7 +495,7 @@ export const AuthPrompt = GObject.registerClass({ showMessageResolver?.(wigglePromise); } - _onVerificationFailed(userVerifier, serviceName, canRetry) { + _onVerificationFailed(serviceName, canRetry) { const wasQueryingService = this._queryingService === serviceName; if (wasQueryingService) { -- 2.39.5